




//
//  OutModel.m
//  FM
//
//  Created by MB__Lee on 2018/4/9.
//  Copyright © 2018年 MB__Lee. All rights reserved.
//

#import "OutModel.h"

#define  Cell_Height 40


@implementation OutModel
+(JSONKeyMapper *)keyMapper{
    
    return  [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{@"OutID":@"id"}];
    
}
+(BOOL)propertyIsOptional:(NSString *)propertyName{
    return  YES;
}

-(void)caculateCellNumAndCellHeight{
    [self caculateCellNum]; //计算cell 总数
    [self caculateCellHeight];//计算cell高度
}

-(void)caculateCellNum{
    
    NSUInteger num = 0;
    for (MiddleModel *model in self.accessories ) {
        num += model.accessory.count;
    }
    num +=self.accessories.count;
    
    

    
    if (self.works.count != 0) {//做works 为空判断
        num += 1;
    }
    
    
    self.cellNum = num;
    
}
-(void)caculateCellHeight{
    
    //cell 个数乘以 cell 的行高  + tableviewHeader 高度
    self.cellHeight = self.cellNum * Cell_Height + Cell_Height;
}



@end
